<template>
	<view class="box">
		<view class="selectMember">
			<view class="memberBox">
				<view class="member" @click="editId || reportStatus == 2? memberdialog = false : memberdialog = true">
					<image src="../../../static/img/quickly/information/add@2x.png"></image>
					<text>{{userName || '选择会员'}}</text>
				</view>
				<template v-if="entrance">
					<view class="save" v-if="reportStatus != 2" @click="seveAdd(1)">保存</view>
					<view class="toSend" v-if="reportStatus != 2"  @click="uploadreport()">上传</view>
				</template>
				<template v-else>
					<view class="save" v-if="status != 2" @click="seveAdd(1)">保存</view>
					<view class="toSend" v-if="status != 2"  @click="seveAdd(2)">签名发送</view>
				</template>
			</view>
		</view>
		<view class="addassess">
			<div class="hd">
				<div class="t">
					<p>体检机构：<input type="text" v-model="examinationOrgan" :disabled="status == 2" @input="[data.examinationOrgan = examinationOrgan]"></p>
					<p>体检时间：
						<picker mode="date" :start="start" :end="end"  :disabled="status == 2" @change="bindDateChange">
							<view class="date">{{start_date}}</view>
						</picker> 
					</p>
				</div>
			</div>
			<div class="bd">
				<div class="table" v-for="item in defaultData">
					<div class="title">{{item.sectionName}}</div>
					<wyb-table ref="table" :headers="headers" :contents="item.contents" @callbackdata="getcallbackdata" />
				</div>
				<div class="yc-warp">
					<div class="title"  @click="[dialog=true,type='yczb',getReportAbnormalPageAxios({pageIndex:pageIndex,pageSize:20})]">异常指标<span v-if="status != 2">载入异常</span></div>
					<table border="1" cellpadding="0" v-if="isCheckYcData.length > 0">
						<tr>
							<th colspan="2">名称</th>
						</tr>
						<tr v-for="(item,index) in isCheckYcData" :key="index">
							<td>{{item.name}}</td>
							<td v-if="status != 2" @click="isCheckYcData.splice(index,1)">删除</td>
						</tr>
					</table>
				</div>
				<div class="dx-warp">
					<div class="title">单项数据体检<span @click="[dialog=true,type='dxsj',getReportTemplateStencilPageAxios({pageIndex:tiOption.pageIndex,pageSize:20})]"  v-if="status != 2">选择体检项目</span></div>
					<div v-if="isCheckDxData.length > 0">
						<wyb-table ref="table" :headers="dialogHeaders3" :contents="isCheckDxData" @callbackdata="dxgetcallbackdata" />
					</div>
				</div>
			</div>
			<div class="dialog" v-if="dialog">
				<div class="bg" @click="dialog = false"></div>
				<div class="content">
					<div class="search">
						项目名称：<input type="text" v-model="abnormalName"/>
						<span @click="onSearch">查询</span>
						<span @click="dialogSubmit">确认</span>
						<image mode="widthFix" src="@/static/img/close.png"  @click="dialog = false"></image>
					</div>
					<wyb-table ref="table" :headers="type=='yczb'?dialogHeaders:dialogHeaders2" @onCheck="onCheck" :contents="dialogcontents" @callbackdata="getcallbackdata" width="91vw" height="60vh" enable-check="multiple" text-align="left" header-bg-color="#38CB97" header-ft-color="#fff" checker-border-color="#ccc" first-col-bg-color="#fff" checker-cell-bg-color="#fff" checker-box-bg-color="#fff"/>
					<div class="btn">
						<span 
							v-if="type=='yczb' && pageIndex != 1 || type!='yczb' && tiOption.pageIndex != 1" 
							@click="type=='yczb'?[pageIndex--,getReportAbnormalPageAxios({abnormalName:abnormalName,pageIndex:pageIndex,pageSize:20})]:[tiOption.pageIndex--,getReportTemplateStencilPageAxios({pageIndex:tiOption.pageIndex,pageSize:20})]">
						上一页</span>
						<span 
							v-if="type=='yczb' && pageIndex != totalCount || type!='yczb' && tiOption.pageIndex != tiOption.totalCount" 
							@click="type=='yczb'?[pageIndex++,getReportAbnormalPageAxios({abnormalName:abnormalName,pageIndex:pageIndex,pageSize:20})]:[tiOption.pageIndex++,getReportTemplateStencilPageAxios({pageIndex:tiOption.pageIndex,pageSize:20})]">
						下一页</span>
					</div>
				</div>
			</div>
		</view>
		
		<member :dialog.sync="memberdialog"  @hidedialog="hidememberdialog" @chooseUser="chooseUser"></member>
		<u-modal v-model="showModal" :show-cancel-button="true" @confirm="Modalconfirm" :content="showContent"></u-modal>
	</view>
</template>

<script src="@/static/js/quickly/medicalReport/entryMedical"></script>

<style lang="scss" scoped>
	@import '@/static/css/quickly/medicalReport/entryMedical.scss';
		.addassess{
			margin-top: 130rpx;
			.title{
				padding:15upx 0;
				text-align: center;
				font-size: 28upx;
				color: #fff;
				background: #38CB97;
				position: relative;
				span{
					position: absolute;
					padding:8upx 12upx;
					background: #C0FEEF;
					right: 28upx;
					top: 8upx;
					color: #000;
					font-size: 26upx;
				}
			}
			.hd{
					padding:24upx 0;
					display: flex;
					justify-content: space-between;
					width: 100%;
				.t{
					padding-left: 24upx;
					flex:1;
					font-size: 30upx;
					color: #3CBE8A;
					p{
						padding-right: 20upx;
						display: flex;
						margin-top: 10upx;
						align-items: center;
						input,uni-picker{
							flex:1;
							// width: 260upx;
							height: 50upx;
							border: 1upx solid #3CBE8A;
							border-radius: 6upx;
							padding-left: 10upx;
							min-height:unset;
							line-height: 50upx;
						}
					}
				}
				button{
					width: 132upx;
					height: 132upx;
					background: #38CB97;
					border-radius:16upx;
					color: #fff;
					line-height: 132upx;
					font-size: 30upx;
					margin-right: 24upx;
					&::after{
						border:none;
					}
				}
			}
		}
		.dialog{
			position: fixed;
			left: 0;
			top: 0;
			width: 100vw;
			height: 100vh;
			z-index: 100;
			.bg{
				width: 100vw;
				height: 100vh;
				position: absolute;
				left: 0;
				top: 0;
				background: rgba(0,0,0,.5);
			}
			.content{
				padding:2vh 2vw;
				position: absolute;
				width: 91vw;
				height: 76vh;
				left: 2.5vw;
				top: 10vh;
				background: #fff;
				.wyb-table-header{
					width: 400upx !important;
				}
				.search{
					display: flex;
					font-size: 26upx;
					align-items: center;
					margin-bottom: 30upx;
					input{
						width: 200upx;
						height: 50upx;
						padding-left: 10upx;
						border: 1upx solid #ccc;
						border-radius: 8upx;
					}
					span{
						display: inline-block;
						padding: 8upx 18upx;
						border: 1upx solid #ccc;
						color: #000;
						margin-left: 20upx;
						border-radius: 8upx;
					}
					image{
						width: 40upx;
						margin-left: 40upx;
					}
				}
			}
			.btn{
				display: flex;
				justify-content: center;
				margin-top: 30upx;
				span{
					display: inline-block;
					margin: 0 20upx;
					width: 150upx;
					height: 40upx;
					text-align: center;
					line-height: 40upx;
					font-size: 26upx;
					border: 1px solid #ccc;
					border-radius:10upx;
				}
			}
		}
		.yc-warp,.dx-warp{
			margin-bottom: 20upx;
			table{
				width: 100%;
				text-align: left;
				border-collapse:collapse;
				font-size: 24upx;
				th{
					padding:12upx;
					background: #e6f3ff;
					color: #333;
				}
				td{
					padding:12upx;
				}
			}
		}
</style>
